package com.example.smartall.ui;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import com.example.smartall.R;
import com.example.smartall.adapter.NewsListAdapter;
import com.example.smartall.entity.NewsBean;
import com.example.smartall.ui.base.BaseActivity;

import java.util.List;

public class SearchResultActivity extends BaseActivity {
    private ImageView imBack;
    private TextView tvTitle;
    private ListView list;

    private List<NewsBean.RowsBean> searchResultData;
    private NewsListAdapter adapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_search_result);

        searchResultData = (List<NewsBean.RowsBean>) getIntent().getSerializableExtra("data");

        init();
        initEvent();
    }

    @Override
    public void init() {
        imBack = (ImageView) findViewById(R.id.im_back);
        tvTitle = (TextView) findViewById(R.id.tv_title);
        list = (ListView) findViewById(R.id.list);

        tvTitle.setText("搜索结果");

        if (searchResultData != null || searchResultData.size() > 0) {
            adapter = new NewsListAdapter(SearchResultActivity.this,searchResultData);
            list.setAdapter(adapter);
        }
    }

    @Override
    public void initEvent() {

    }
}